$(document).ready(function() {
    get_hash();
});
function top_user(){
	var asort = 0;
	topuser_icons = {};
	xfunc = "topuser/list_topuser";
	
	data_sent = {};
		
		$.ajax({ 
			type: "POST", // request type POST
			url: base_url+xfunc, // post to PHP file
			data: data_sent, // request send to PHP file
			dataType:'json',
			success: function(result){ // result = return from php request
				$(result.intID).each(function(k,v){
					asort = result.intPoints[k];
					topuser_icons_panel = '';
						topuser_icons_panel +='<tr>';
						topuser_icons_panel +='<td><img width="86" height="66" class="img-rounded" src="'+base_url+'assets/uploaded/user_img/thumbnail/'+result.strImgLink[k]+'" alt=""/></td>';
							topuser_icons_panel +='<td>'+result.strUserName[k]+'</td>';
							topuser_icons_panel +='<td>'+result.intPoints[k]+'</td>';
							//topuser_icons_panel +='<td>'+result.intAvailablePoints[k]+'</td>';
							//topuser_icons_panel +='<td>'+result.intCredits[k]+'</td>';
						topuser_icons_panel +='</tr>';
						topuser_icons[result.intID[k]]=topuser_icons_panel;
				});
				
				topuser_html_panel = '<table class="table table-striped table-bordered" id="topuser_table">';
				topuser_html_panel += '<thead>';
					topuser_html_panel += '<tr>';
						topuser_html_panel += '<th class="thumb-photo">Photo</th>';
						topuser_html_panel += '<th>Username</th>';
						topuser_html_panel += '<th class="note-title">Points</th>';
						//topuser_html_panel += '<th class="extra">Available Points</th>';
						//topuser_html_panel += '<th class="note-title">Credits</th>';
					topuser_html_panel += '</tr>';
				topuser_html_panel += '</thead>';
				topuser_html_panel += '<tbody>';
				
				for(x=0;x<=asort;x++){
					if($.trim(topuser_icons[x])!=""){
						topuser_html_panel +=topuser_icons[x];
					}	
				}		
				topuser_html_panel += '</tbody>';		
				topuser_html_panel += '</table>';
				
				$('#topuser_content').html(topuser_html_panel);
				$('#topuser_table').dataTable({
					"sPaginationType": "full_numbers",
					"bLengthChange": false,
	                "aoColumns": [
	                              {"bSortable": true},
	                              {"bSortable": false},
	                              null,
	                             // {"iDataSort": 4},
	                              //{"bVisible": false}
	                             ]
				});
			}
		});	
}